/**
 * @author 蔡明宗
 * @date 2010-11-24 下午07:03:01
 */

package com.ad.dao;

import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.ad.hibernate.UserInformation;

public class UserInfoDao extends HibernateDaoSupport implements IUserInfoDao {

	@SuppressWarnings("unchecked")
	@Override
	public UserInformation getUserInfo(String userId) {
		List<UserInformation> result = this.getHibernateTemplate().find(
				"from UserInformation where userId=" + userId);
		if (result == null || result.size() != 1) {
			return null;
		}
		return result.get(0);
	}

	@Override
	public void insertUserInfor(UserInformation userInfo) {
		this.getHibernateTemplate().save(userInfo);
	}

	@Override
	public void update(UserInformation userInfo) {
		this.getHibernateTemplate().update(userInfo);
	}

}
